<html>
  <head>
    <script type="text/javascript" src="https://pubnub.github.io/eon/v/eon/1.0.0/eon.js"></script>
    <link type="text/css" rel="stylesheet" href="https://pubnub.github.io/eon/v/eon/1.0.0/eon.css"/>
  </head>
  <body>
    <div id="chart"></div>
    <script>

      var pubnub = new PubNub({
        publishKey: 'your_pub_key',
        subscribeKey: 'your_sub_key'
      });

      var channel = "c3-spline-" + new Date().getTime();

      eon.chart({
        channels: [channel],
        flow: true,
        pubnub: pubnub,
        limit: 100,
        xType: 'custom',
        xId: 'pub_time',
        generate: {
          bindto: '#chart',
          data: {
            type: 'spline',
            labels: false
          }
        }
      });
    </script>
    <script>
      setInterval(function(){

        var data = [];
        var date = new Date().getTime();

        for(var i = 0; i < 10; i++) {
            data.push({
                'pub_time': date + (100 * i),
                'Austin': Math.floor(Math.random() * 99)
            });
        }

        pubnub.publish({
          channel: channel,
          message: {
            eons: data
          }
        });


        data2 = [];
        date2 = new Date().getTime();
        for(var j = 0; j < 10; j++) {
            data2.push({
                'pub_time': date2 + (100 * j),
                'San Francisco': Math.floor(Math.random() * 99)
            });
        }

        pubnub.publish({
          channel: channel,
          message: {
            eons: data2
          }
        });

      }, 1000);
    </script>
  </body>
</html>
